home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Sample Code / AppsToGo / DTS.Lib / DTS.Lib.headers / AEUtils.h next >
Encoding:
C/C++ Source or Header  |  1994-03-24  |  3.2 KB  |  96 lines  |  [TEXT/MPS ]

  1. #ifndef __AEUTILS__
  2. #define __AEUTILS__
  3.  
  4. #ifndef __TYPES__
  5. #include <Types.h>
  6. #endif
  7.  
  8. #ifndef __APPLEEVENTS__
  9. #include <AppleEvents.h>
  10. #endif
  11.  
  12. #ifndef __EVENTS__
  13. #include <Events.h>
  14. #endif
  15.  
  16. #ifndef __WINDOWS__
  17. #include <Windows.h>
  18. #endif
  19.  
  20. void    DoHighLevelEvent(EventRecord *event);
  21.     /*
  22.     ** INPUT:    event
  23.     **
  24.     ** Simply calls AEProcessAppleEvent and reports any errors.
  25.     ** AEProcessAppleEvent looks in its table of registered events and sees if
  26.     ** the current event is registered.  If so, off we go. */
  27.  
  28.  
  29.  
  30. OSErr    GetTargetInfo(AEAddressDesc targetDesc, StringPtr zone, StringPtr machine,
  31.                               StringPtr application);
  32.     /*
  33.     ** INPUT:    targetDesc        A properly constructed target descriptor.
  34.     ** OUTPUT:    zone            The zone name extracted from targetDesc.
  35.     **            machine            The machine name extracted from targetDesc
  36.     **            application        The application name extracted from targetDesc
  37.     ** RESULT:    OSErr
  38.     **
  39.     ** This function returns the zone, machine, and application name for the
  40.     ** indicated target descriptor. */
  41.  
  42.  
  43.  
  44. OSErr    MakeTarget(AEAddressDesc *target, Boolean sendDirect, short replyMode, Str255 prompt,
  45.                            Str255 applListLabel, PPCFilterUPP portFilter, char *theLocNBPType);
  46.     /*
  47.     ** INPUT:    sendDirect        Pass in true if we are sending the AppleEvent to
  48.     **                            ourselves (this application).  Note that passing in false
  49.     **                            doesn't exclude the possibility of sending to ourself.
  50.     **            replyMode        kAEWaitReply, kAEQueueReply, or kAENoReply
  51.     **            prompt            PPCBrowser dialog box prompt
  52.     **            applListLabel    The PPCBrowser title over the 'programs' list
  53.     **            portFilter        Procedure pointer for PPCBrowser filter (or nil)
  54.     **            theLocNBPType    List ports only of this type
  55.     ** OUTPUT:    target            AEAddressDesc of target returned here
  56.     ** RESULT:    OSErr            If err returned, then target not created.  Note that
  57.     **                            the dataHandle field of target is initialized to nil
  58.     **                            so that you can always call AEDisposeDesc, independent
  59.     **                            of whether or not an error was returned.
  60.     **
  61.     ** Creates a TargetID.
  62.     **
  63.     ** If sendDirect is TRUE, the target is specified by setting a
  64.     ** ProcessSerialNumber to kCurrentProcess.  This has the advantage of sending
  65.     ** the message directly to ourselves, bypassing ePPC and gaining about a 10-15x
  66.     ** speed improvement.  If sendDirect is FALSE, we see if we have the
  67.     ** PPCToolBox.  If not, then we are forced to do a direct send.  If we do have
  68.     ** the PPCToolbox, then we call PPCBrowser.  We then look at the reply, and
  69.     ** factor in the mode we are going to use in AESend.  If that mode is
  70.     ** kAEWaitReply and the user selected us as the target, we have to turn that
  71.     ** into a direct send.  This is because the AppleEvent Manager will otherwise
  72.     ** post the event as a high-level event.  However, we are busy waiting for a
  73.     ** reply, not looking for events, so we'll hang.  We avoid this by forcing a
  74.     ** direct send. */
  75.  
  76.  
  77.  
  78.  
  79. Boolean    MissedAnyParameters(AppleEvent *message);
  80.     /*
  81.     ** INPUT:    message        AppleEvent to check for unused parameters
  82.     ** OUTPUT:    Boolean        Returns true if at least one paramater missed
  83.     */
  84.  
  85.  
  86.  
  87. void    NotifyCancel(void);
  88. void    NotifyUser(void);
  89.     /*
  90.     ** These are simplistic calls for Notification Manager support.  Just call NotifyUser
  91.     ** if a notification is needed.  Just call NotifyCancel to cancel the notification
  92.     ** posted by NotifyUser. */
  93.  
  94.  
  95. #endif
  96.